home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1995 #5 & #6 / Amiga Plus CD - 1995 - No. 5 and 6.iso / tex / mf / inputs / cm / cmman.mf < prev    next >
Text File  |  1993-11-28  |  29KB  |  643 lines

  1. % Variants of Computer Modern, specially for the TeX/METAFONT manuals
  2.  
  3. if unknown cmbase: input cmbase fi
  4. mode_setup;
  5.  
  6. def generate suffix t= enddef;
  7.  
  8. inner cmchar;
  9.  
  10. font_size 10pt#;
  11. font_identifier "CMMAN";
  12. font_coding_scheme "PI";
  13.  
  14. input cmtt10; font_setup;
  15.  
  16. cmchar "Cross between 0 and O";
  17. beginchar("0",9u#,fig_height#,0);
  18. italcorr fig_height#*slant-.5u#;
  19. adjust_fit(0,0);
  20. penpos1(vair,90); penpos3(vair,-90); penpos2(curve,180); penpos4(curve,0);
  21. superness:=.77;
  22. x2r=round max(.7u,1.45u-.5curve); x4r=w-x2r; x1=x3=.5w;
  23. y1r=h+o; y3r=-o; y2=y4=.5h-vair_corr; y2l:=y4l:=.52h;
  24. penstroke pulled_arc.e(1,2) & pulled_arc.e(2,3)
  25.  & pulled_arc.e(3,4) & pulled_arc.e(4,1) & cycle;  % bowl
  26. penlabels(1,2,3,4); endchar;
  27.  
  28. input cmssq8; slant:=sind 12/cosd 12; font_setup;
  29.  
  30. cmchar "Lowercase Greek beta";
  31. beginchar(oct"014",9.5u#,asc_height#,desc_depth#);
  32. italcorr .5[x_height#,asc_height#]*slant-u#;
  33. adjust_fit(0,0); pickup fine.nib;
  34. pos0(hair,180); pos1(hair,180); pos2(vair,90);
  35. pos3(stem,0); pos4(vair,-90); pos5(hair,-180);
  36. pos6(vair,-270); pos7(curve,-360); pos8(vair,-450); pos9(hair,-540);
  37. x0=x1=x9; lft x0l=hround(1.5u-.5hair); x2=x4=x6=x8=.5w+.25u;
  38. rt x3r=hround(w-1.5u); rt x7r=hround(w-1.5u+.5curve); rt x5l=hround(x4-u);
  39. bot y0=-d; y1=top y6r=x_height; top y2r=h+oo; y3=.5[y2,y4];
  40. y5=.5[y4,y6]; top y6r-bot y4r=vstem+eps; bot y8=-oo; y7=y9=.5[y6,y8];
  41. if y6l<y4l: y6l:=y4l:=y5; fi
  42. filldraw stroke z0e---z1e...pulled_arc.e(2,3)
  43.  & pulled_arc.e(3,4)...{up}z5e;  % stem and upper bowl
  44. filldraw stroke z5e{up}...pulled_arc.e(6,7)
  45.  & pulled_arc.e(7,8)...{up}z9e;  % lower bowl
  46. math_fit(desc_depth#*slant+.5hair#-u#,.7x_height#*slant+.5curve#-1.5u#);
  47. penlabels(0,1,2,3,4,5,6,7,8,9); endchar;
  48.  
  49. cmchar "Lowercase thorn";
  50. beginchar(oct"015",10u#+serif_fit#,asc_height#,desc_depth#);
  51. italcorr .5x_height#*slant+min(.5curve#-.85u#,-.1u#);
  52. adjust_fit(serif_fit#,0);
  53. pickup tiny.nib; pos1(stem',0); pos2(stem,0);
  54. pos0'(stem',0); pos0(stem,0); z0l=z0'l; x0'=x1; x0=x2;
  55. lft x1l=hround(2.5u-.5stem'); top y1=h;
  56. numeric edge; edge=rt x2r;
  57. pickup fine.nib; pos3(if hefty:thin_join else: hair fi,180);
  58. pos4(vair',90); pos5(curve,0); pos6(vair,-90);
  59. rt x3l=1/3[rt x2,edge]; y3=1/8[bar_height,x_height];
  60. x4l=w-.5(w-serif_fit)+.5u; top y4r=x_height+oo;
  61. rt x5r=hround min(w-1.35u+.5curve,w-.6u); y5=.5x_height;
  62. x6=x3; bot y6r=-oo;
  63. (x,y4r)=whatever[z3l,z4l]; x4r:=min(x,.5[x5r,x4]);
  64. filldraw stroke z3e{up}...{right}z4e&super_arc.e(4,5)
  65.  &z5e{down}...{5(x6-x5),y6-y5}z6e;  % bowl
  66. y0=ypart(((edge,h)--(edge,0))intersectionpoint(z3l{up}...{right}z4l));
  67. pickup tiny.nib; bot y2=-d;
  68. filldraw stroke z1e--z0'e--z0e--z2e;  % stem
  69. pickup crisp.nib; pos8(hair,0); pos7'(stem,0);
  70. z7'=z2; x8l=x7'l; bot y8=0;
  71. filldraw stroke z7'e--z8e;  % point
  72. if serifs: sloped_serif.l(1,0',a,1/3,jut,serif_drop);  % upper serif
  73.  dish_serif(2,0,b,1/3,jut,c,1/3,0); fi  % lower serif
  74. penlabels(0,1,2,3,4,5,6,8); endchar;
  75.  
  76. input cmr10; font_setup;
  77.  
  78. message "Parentheses";
  79. code:=ASCII "0"; % the characters will be 123456789:
  80. for c=0,1,2,4,infinity:
  81. cmchar "Left paren with curl "&decimal c;
  82. beginchar(incr code,7u#,body_height#,paren_depth#);
  83. italcorr body_height#*slant-.5u#;
  84. adjust_fit(0,0); pickup fine.nib;
  85. pos1(vair,0); pos2(.75[hair,stem],0); pos3(vair,0);
  86. rt x1r=rt x3r=round(w-u); lft x2l=round(x1-4u if monospace: +4/3u fi);
  87. top y1=h; y2=.5[y1,y3]=math_axis;
  88. filldraw stroke z1e{curl c}..z2e..{curl c}z3e;  % arc
  89. penlabels(1,2,3); endchar;
  90.  
  91. cmchar "Right paren with curl "&decimal c;
  92. beginchar(incr code,7u#,body_height#,paren_depth#);
  93. italcorr math_axis#*slant-.5u#;
  94. adjust_fit(0,0); pickup fine.nib;
  95. pos1(vair,0); pos2(.75[hair,stem],0); pos3(vair,0);
  96. lft x1l=lft x3l=round u; rt x2r=round(x1+4u if monospace: -4/3u fi);
  97. top y1=h; y2=.5[y1,y3]=math_axis;
  98. filldraw stroke z1e{curl c}..z2e..{curl c}z3e;  % arc
  99. penlabels(1,2,3); endchar;
  100. endfor
  101.  
  102. cmchar "Variant letter g";
  103. beginchar("g",10u#+serif_fit#,x_height#,desc_depth#);
  104. italcorr x_height#*slant-serif_fit#+.5stem#-2u# if serifs:+.5u# fi;
  105. adjust_fit(0,serif_fit# if serifs: -.5u# fi);
  106. pickup tiny.nib; pos1(stem',0); pos2(stem,0);
  107. pos0'(stem',0); pos0(stem,0); z0r=z0'r; x0'=x1; x0=x2;
  108. rt x1r=hround(w-2.5u+.5stem');
  109. numeric edge; edge=lft x2l;
  110. path edge_path; edge_path=(edge,h)--(edge,0);
  111. pickup fine.nib; pos3(if hefty:thin_join else: hair fi,0);
  112. pos4(vair,90); pos5(curve,180); pos6(vair,270); penpos7(x3r-x3l,360);
  113. lft x3l=min(lft x3l-(rt x3r-tiny.rt x2r),2/3[lft x2,edge]); y3=bar_height;
  114. x4l=.5(w-serif_fit)-.3u; top y4r=x_height+oo;
  115. lft x5r=hround max(1.35u-.5curve,.6u); y5=.5x_height;
  116. x6l=x4l-.2u; bot y6r=vround 1/3vair;
  117. lft x7l=edge; y7=min(y3,y6+y4-y3+.6vair);
  118. (x,y4r)=whatever[z3l,z4l]; x4r:=max(x,.5[x5r,x4]);
  119. (x',y6r)=whatever[z7l,z6l]; x6r:=max(x',.5[x5r,x6]);
  120. filldraw stroke z3e{up}...{left}z4e&super_arc.e(4,5)
  121.  &super_arc.e(5,6)&z6e{right}...{up}z7e;  % bowl
  122. y1=ypart(edge_path intersectionpoint(z3l{up}...{left}z4l));
  123. y0=ypart(edge_path intersectionpoint(z7l{down}...{left}z6l));
  124. pickup tiny.nib; bot y2=if serifs: -.25d else: 0 fi;
  125. filldraw stroke z1e--z0'e--z0e--z2e;  % stem
  126. pickup crisp.nib;
  127. pos8(hround(hair-stem_corr),0); pos7'(stem',0);
  128. z7'=z1; x8r=x7'r; top y8=h+oo;
  129. filldraw stroke z7'e--z8e;  % point
  130. if serifs: pickup tiny.nib;
  131.  pos9(vair,-90); x9=.5[x2,x10]; bot y9r=-d-o-1;
  132.  pos10(hair,-180); lft x10r=hround u; y10=-.75d+.5flare;
  133.  pos11(flare,-180); z11r=z10r;
  134.  bulb(9,10,11); filldraw stroke super_arc.e(2,9);  % tail
  135. else: pickup fine.nib; pos2'(stem,0); z2'=z2;
  136.  z2''r=z2'r; z2''=z2'; z2''l=(x2'l,0);
  137.  pos9(vair,-90); x9=4.5u; bot y9r=-d-o-1;
  138.  pos10(.5[vair,flare],-90); lft x10=hround 1.25u;
  139.  y10r=good.y -5/6d; y10l:=good.y y10l;
  140.  filldraw stroke z2'e..z2''e&super_arc.e(2'',9)
  141.   & term.e(9,10,left,.9,4); fi  % tail
  142. penlabels(0,1,2,3,4,5,6,7,8,9,10,11); endchar;
  143.  
  144. input cmtt9; font_setup;
  145.  
  146. cmchar "Variant letter g";
  147. beginchar("x",10u#+serif_fit#,x_height#,desc_depth#);
  148. italcorr x_height#*slant-serif_fit#+.5stem#-2u# if serifs:+.5u# fi;
  149. adjust_fit(0,serif_fit# if serifs: -.5u# fi);
  150. pickup tiny.nib; pos1(stem',0); pos2(stem,0);
  151. pos0'(stem',0); pos0(stem,0); z0r=z0'r; x0'=x1; x0=x2;
  152. rt x1r=hround(w-2.5u+.5stem');
  153. numeric edge; edge=lft x2l;
  154. path edge_path; edge_path=(edge,h)--(edge,0);
  155. pickup fine.nib; pos3(if hefty:thin_join else: hair fi,0);
  156. pos4(vair,90); pos5(curve,180); pos6(vair,270); penpos7(x3r-x3l,360);
  157. lft x3l=min(lft x3l-(rt x3r-tiny.rt x2r),2/3[lft x2,edge]); y3=bar_height;
  158. x4l=.5(w-serif_fit)-.3u; top y4r=x_height+oo;
  159. lft x5r=hround max(1.35u-.5curve,.6u); y5=.5x_height;
  160. x6l=x4l-.2u; bot y6r=vround 1/3vair;
  161. lft x7l=edge; y7=min(y3,y6+y4-y3+.6vair);
  162. (x,y4r)=whatever[z3l,z4l]; x4r:=max(x,.5[x5r,x4]);
  163. (x',y6r)=whatever[z7l,z6l]; x6r:=max(x',.5[x5r,x6]);
  164. filldraw stroke z3e{up}...{left}z4e&super_arc.e(4,5)
  165.  &super_arc.e(5,6)&z6e{right}...{up}z7e;  % bowl
  166. y1=ypart(edge_path intersectionpoint(z3l{up}...{left}z4l));
  167. y0=ypart(edge_path intersectionpoint(z7l{down}...{left}z6l));
  168. pickup tiny.nib; bot y2=if serifs: -.25d else: 0 fi;
  169. filldraw stroke z1e--z0'e--z0e--z2e;  % stem
  170. pickup crisp.nib;
  171. pos8(hround(hair-stem_corr),0); pos7'(stem',0);
  172. z7'=z1; x8r=x7'r; top y8=h+oo;
  173. filldraw stroke z7'e--z8e;  % point
  174. if serifs: pickup tiny.nib;
  175.  pos9(vair,-90); x9=.5[x2,x10]; bot y9r=-d-o-1;
  176.  pos10(hair,-180); lft x10r=hround u; y10=-.75d+.5flare;
  177.  pos11(flare,-180); z11r=z10r;
  178.  bulb(9,10,11); filldraw stroke super_arc.e(2,9);  % tail
  179. else: pickup fine.nib; pos2'(stem,0); z2'=z2;
  180.  z2''r=z2'r; z2''=z2'; z2''l=(x2'l,0);
  181.  pos9(vair,-90); x9=4.5u; bot y9r=-d-o-1;
  182.  pos10(.5[vair,flare],-90); lft x10=hround 1.25u;
  183.  y10r=good.y -5/6d; y10l:=good.y y10l;
  184.  filldraw stroke z2'e..z2''e&super_arc.e(2'',9)
  185.   & term.e(9,10,left,.9,4); fi  % tail
  186. penlabels(0,1,2,3,4,5,6,7,8,9,10,11); endchar;
  187.  
  188. input cmbx9; font_setup;
  189.  
  190. cmchar "Variant letter g";
  191. beginchar("y",10u#+serif_fit#,x_height#,desc_depth#);
  192. italcorr x_height#*slant-serif_fit#+.5stem#-2u# if serifs:+.5u# fi;
  193. adjust_fit(0,serif_fit# if serifs: -.5u# fi);
  194. pickup tiny.nib; pos1(stem',0); pos2(stem,0);
  195. pos0'(stem',0); pos0(stem,0); z0r=z0'r; x0'=x1; x0=x2;
  196. rt x1r=hround(w-2.5u+.5stem');
  197. numeric edge; edge=lft x2l;
  198. path edge_path; edge_path=(edge,h)--(edge,0);
  199. pickup fine.nib; pos3(if hefty:thin_join else: hair fi,0);
  200. pos4(vair,90); pos5(curve,180); pos6(vair,270); penpos7(x3r-x3l,360);
  201. lft x3l=min(lft x3l-(rt x3r-tiny.rt x2r),2/3[lft x2,edge]); y3=bar_height;
  202. x4l=.5(w-serif_fit)-.3u; top y4r=x_height+oo;
  203. lft x5r=hround max(1.35u-.5curve,.6u); y5=.5x_height;
  204. x6l=x4l-.2u; bot y6r=vround 1/3vair;
  205. lft x7l=edge; y7=min(y3,y6+y4-y3+.6vair);
  206. (x,y4r)=whatever[z3l,z4l]; x4r:=max(x,.5[x5r,x4]);
  207. (x',y6r)=whatever[z7l,z6l]; x6r:=max(x',.5[x5r,x6]);
  208. filldraw stroke z3e{up}...{left}z4e&super_arc.e(4,5)
  209.  &super_arc.e(5,6)&z6e{right}...{up}z7e;  % bowl
  210. y1=ypart(edge_path intersectionpoint(z3l{up}...{left}z4l));
  211. y0=ypart(edge_path intersectionpoint(z7l{down}...{left}z6l));
  212. pickup tiny.nib; bot y2=if serifs: -.25d else: 0 fi;
  213. filldraw stroke z1e--z0'e--z0e--z2e;  % stem
  214. pickup crisp.nib;
  215. pos8(hround(hair-stem_corr),0); pos7'(stem',0);
  216. z7'=z1; x8r=x7'r; top y8=h+oo;
  217. filldraw stroke z7'e--z8e;  % point
  218. if serifs: pickup tiny.nib;
  219.  pos9(vair,-90); x9=.5[x2,x10]; bot y9r=-d-o-1;
  220.  pos10(hair,-180); lft x10r=hround u; y10=-.75d+.5flare;
  221.  pos11(flare,-180); z11r=z10r;
  222.  bulb(9,10,11); filldraw stroke super_arc.e(2,9);  % tail
  223. else: pickup fine.nib; pos2'(stem,0); z2'=z2;
  224.  z2''r=z2'r; z2''=z2'; z2''l=(x2'l,0);
  225.  pos9(vair,-90); x9=4.5u; bot y9r=-d-o-1;
  226.  pos10(.5[vair,flare],-90); lft x10=hround 1.25u;
  227.  y10r=good.y -5/6d; y10l:=good.y y10l;
  228.  filldraw stroke z2'e..z2''e&super_arc.e(2'',9)
  229.   & term.e(9,10,left,.9,4); fi  % tail
  230. penlabels(0,1,2,3,4,5,6,7,8,9,10,11); endchar;
  231.  
  232. message "big G";
  233. u#:=50/36pt#;      % unit width
  234. width_adj#:=0pt#;    % width adjustment for certain characters
  235. serif_fit#:=0pt#;    % extra sidebar near lowercase serifs
  236. cap_serif_fit#:=0/36pt#;  % extra sidebar near uppercase serifs
  237. letter_fit#:=0pt#;    % extra space added to all sidebars
  238.  
  239. body_height#:=12pt#+250/36pt#;  % height of tallest characters
  240. asc_height#:=body_height#;  % height of lowercase ascenders
  241. cap_height#:=body_height#;  % height of caps
  242. fig_height#:=body_height#;  % height of numerals
  243. x_height#:=155/250asc_height#;  % height of lowercase without ascenders
  244. math_axis#:=90/250asc_height#;  % axis of symmetry for math symbols
  245. bar_height#:=87/250asc_height#;  % height of crossbar in lowercase e
  246. comma_depth#:=70/250asc_height#;% depth of comma below baseline
  247. desc_depth#:=comma_depth#;  % depth of lowercase descenders
  248.  
  249. crisp#:=0pt#;      % diameter of serif corners
  250. tiny#:=1.2/36pt#;    % diameter of rounded corners
  251. fine#:=1.1/36pt#;    % diameter of sharply rounded corners
  252. thin_join#:=1.1/36pt#;    % width of extrafine details
  253. hair#:=14/36pt#;    % lowercase hairline breadth
  254. stem#:=75/36pt#;    % lowercase stem breadth
  255. curve#:=90/36pt#;    % lowercase curve breadth
  256. ess#:=81/36pt#;      % breadth in middle of lowercase s
  257. flare#:=66/36pt#;    % diameter of bulbs or breadth of terminals
  258. dot_size#:=114/36pt#;    % diameter of dots
  259. cap_hair#:=17/36pt#;    % uppercase hairline breadth
  260. cap_stem#:=96/36pt#;    % uppercase stem breadth
  261. cap_curve#:=111/36pt#;    % uppercase curve breadth
  262. cap_ess#:=105/36pt#;    % breadth in middle of uppercase s
  263. rule_thickness#:=1pt#;    % thickness of lines in math symbols
  264.  
  265. dish#:=2/36pt#;      % amount erased at top or bottom of serifs
  266. bracket#:=50/36pt#;    % vertical distance from serif base to tangent
  267. jut#:=70/36pt#;      % protrusion of lowercase serifs
  268. cap_jut#:=2.5pt#;    % protrusion of uppercase serifs
  269. beak_jut#:=25/36pt#;    % horizontal protrusion of beak serifs
  270. beak#:=comma_depth#;    % vertical protrusion of beak serifs
  271. vair#:=12/36pt#;    % vertical diameter of hairlines
  272. notch_cut#:=22pt#;    % maximum breadth above or below notches
  273. bar#:=17/36pt#;      % lowercase bar thickness
  274. slab#:=17/36pt#;    % serif and arm thickness
  275. cap_bar#:=17/36pt#;    % uppercase bar thickness
  276. cap_band#:=17/36pt#;    % uppercase thickness above/below lobes
  277. cap_notch_cut#:=22pt#;    % max breadth above/below uppercase notches
  278. serif_drop#:=10/36pt#;    % vertical drop of sloped serifs
  279. stem_corr#:=3/36pt#;    % for small refinements of stem breadth
  280. vair_corr#:=2/36pt#;    % for small refinements of hairline height
  281. apex_corr#:=0pt#;    % extra width at diagonal junctions
  282.  
  283. o#:=12/36pt#;      % amount of overshoot for curves
  284. apex_o#:=12/36pt#;    % amount of overshoot for diagonal junctions
  285.  
  286. slant:=0;      % tilt ratio $(\Delta x/\Delta y)$
  287. fudge:=1;      % factor applied to weights of heavy characters
  288. math_spread:=0;      % extra openness of math symbols
  289. superness:=1/sqrt2;    % parameter for superellipses
  290. superpull:=1/6;      % extra openness inside bowls
  291. beak_darkness:=11/30;    % fraction of triangle inside beak serifs
  292. ligs:=2;      % level of ligatures to be included
  293.  
  294. square_dots:=false;    % should dots be square?
  295. hefty:=false;      % should we try hard not to be overweight?
  296. serifs:=true;      % should serifs and bulbs be attached?
  297. monospace:=false;    % should all characters have the same width?
  298. variant_g:=false;    % should an italic-style g be used?
  299. low_asterisk:=false;    % should the asterisk be centered at the axis?
  300. math_fitting:=false;    % should math-mode spacing be used?
  301.  
  302. font_setup;
  303.  
  304. cmchar "The letter G";
  305. if serifs: beginchar("G",14u#,cap_height#,0);
  306.  italcorr cap_height#*slant-1.5u#-.5cap_serif_fit#;
  307.  adjust_fit(0,.5cap_serif_fit#);
  308.  pickup tiny.nib; pos0(cap_stem,0); pos7(cap_stem,0);
  309.  rt x0r=hround(w-2u); y0=good.y(.1[bar_height,x_height]+1); x7=x0;
  310.  pickup fine.nib;
  311.  if hefty: bot y7=0; pos5(cap_stem,0); x5=x0; top y5=tiny.top y0;
  312.  else: pos5(cap_hair,0); pos8(cap_stem,0);
  313.   y7=.5bar_height; z5l=z8l; z8=z7; x9=x8r; bot y9=0;
  314.   filldraw z8l{down}..{4(x9-x8),y9-y8}z9--z8r--cycle; fi % spur
  315.  pos1(cap_hair,0); pos2(cap_band,90);
  316.  pos3(cap_curve,180); pos4(cap_band,270);
  317.  rt x1r=hround(w-2u); lft x3r=hround u; x2=x4=.55[x3,x1];
  318.  top y2r=h+o; bot y4r=-o; y3=.5[y2,y4];
  319.  bot y1=vround max(.6h,x_height-.5vair);
  320.  (x2l',y2l)=whatever[z2r,z1l]; x2l:=x2l';
  321.  (x4l',y4l)=whatever[z4r,z5l]; x4l:=x4l';
  322.  filldraw stroke z1e{x2-x1,10(y2-y1)}
  323.   ...pulled_arc.e(2,3) & pulled_arc.e(3,4)...z5e{up}; % arc
  324.  x6=x1r; top y6=h+o; x1r-x1'=2cap_curve-fine; y1'=y1;
  325.  path upper_arc; upper_arc=z1{x2-x1,10(y2-y1)}..{left}z2;
  326.  numeric t; t=xpart(upper_arc intersectiontimes (z6--z1'));
  327.  filldraw subpath(0,t) of upper_arc--z6--z1r--z1--cycle; % barb
  328.  pickup tiny.nib; filldraw stroke z0e--z7e;  % stem
  329.  dish_serif(0,7,a,1/3,max(cap_jut,2.25u),b,1/3,1.25u);  % serif
  330.  math_fit(-.3cap_height#*slant-.5u#,ic#);
  331. else: beginchar("G",12u#,cap_height#,0);
  332.  italcorr cap_height#*slant-.5u#;
  333.  adjust_fit(0,0);
  334.  pickup fine.nib; pos1(1.2flare,80); pos2(slab,90);
  335.  pos3(cap_curve,180); pos4(slab,270); pos5(flare,270);
  336.  rt x1r=hround(w-1.35u); x2=x4=.5w+u;
  337.  lft x3r=hround max(u,2u-.5cap_curve); rt x5l=hround(w-1.2u);
  338.  top y1r=vround .93h+o; top y2r=h+o; y3=.5h;
  339.  bot y4r=-o; bot y5r=vround .07h-o;
  340.  filldraw stroke rterm.e(2,1,right,.9,4)&super_arc.e(2,3)
  341.   & super_arc.e(3,4) & term.e(4,5,right,1,4); % arc and terminals
  342.  pos0(stem,0); pos7(stem,0);
  343.  z7r=z5r; x0=x7; top y0=1+vround .35[bar_height,x_height];
  344.  filldraw stroke z0e--z7e;  % stem
  345.  pos8(cap_bar,90); pos9(cap_bar,90);
  346.  z0r=z9r; y8=y9; lft x8=hround x4;
  347.  filldraw stroke z8e--z9e;  % bar
  348.  math_fit(-.3cap_height#*slant-.5u#,.5ic#); fi
  349. penlabels(0,1,1',2,3,4,5,6,7,8,9); endchar;
  350.  
  351. message "The TeXbook title";
  352. f:=20/3; % magnification factor (based mostly on cmssdc10)
  353. u#:=f*19/36pt#;      % unit width
  354. width_adj#:=f*15/36pt#;    % width adjustment for certain characters
  355. serif_fit#:=-f*8/36pt#;    % extra sidebar near lowercase serifs
  356. cap_serif_fit#:=-f*9/36pt#;  % extra sidebar near uppercase serifs
  357. letter_fit#:=-.2u#;    % extra space added to all sidebars
  358.  
  359. body_height#:=f*270/36pt#;  % height of tallest characters
  360. asc_height#:=f*265/36pt#;  % height of lowercase ascenders
  361. cap_height#:=f*265/36pt#;  % height of caps
  362. fig_height#:=f*265/36pt#;  % height of numerals
  363. x_height#:=f*170/36pt#;    % height of lowercase without ascenders
  364. math_axis#:=f*95/36pt#;    % axis of symmetry for math symbols
  365. bar_height#:=f*95/36pt#;  % height of crossbar in lowercase e
  366. comma_depth#:=f*40/36pt#;  % depth of comma below baseline
  367. desc_depth#:=f*60/36pt#;  % depth of lowercase descenders
  368.  
  369. crisp#:=5*23/36pt#;    % diameter of serif corners
  370. tiny#:=5*23/36pt#;    % diameter of rounded corners
  371. fine#:=5*8/36pt#;    % diameter of sharply rounded corners
  372. thin_join#:=12*8/36pt#;    % width of extrafine details
  373. hair#:=5*40/36pt#;    % lowercase hairline breadth
  374. stem#:=5*40/36pt#;    % lowercase stem breadth
  375. curve#:=5*40/36pt#;    % lowercase curve breadth
  376. ess#:=5*37/36pt#;    % breadth in middle of lowercase s
  377. flare#:=5*31/36pt#;    % diameter of bulbs or breadth of terminals
  378. dot_size#:=5*38/36pt#;    % diameter of dots
  379. cap_hair#:=5*40/36pt#;    % uppercase hairline breadth
  380. cap_stem#:=5*44/36pt#;    % uppercase stem breadth
  381. cap_curve#:=5*44/36pt#;    % uppercase curve breadth
  382. cap_ess#:=5*42/36pt#;    % breadth in middle of uppercase s
  383. rule_thickness#:=5*25/36pt#;  % thickness of lines in math symbols
  384.  
  385. dish#:=0pt#;      % amount erased at top or bottom of serifs
  386. bracket#:=0pt#;      % vertical distance from serif base to tangent
  387. jut#:=0pt#;      % protrusion of lowercase serifs
  388. cap_jut#:=0pt#;      % protrusion of uppercase serifs
  389. beak_jut#:=0pt#;    % horizontal protrusion of beak serifs
  390. beak#:=f*1.5/36pt#;    % vertical protrusion of beak serifs
  391. vair#:=6*23/36pt#;    % vertical diameter of hairlines
  392. notch_cut#:=6*40/36pt#;    % maximum breadth above or below notches
  393. bar#:=6*23/36pt#;    % lowercase bar thickness
  394. slab#:=6*31/36pt#;    % serif and arm thickness
  395. cap_bar#:=6*29/36pt#;    % uppercase bar thickness
  396. cap_band#:=6*27/36pt#;    % uppercase thickness above/below lobes
  397. cap_notch_cut#:=6*37/36pt#;  % max breadth above/below uppercase notches
  398. serif_drop#:=f*2/36pt#;    % vertical drop of sloped serifs
  399. stem_corr#:=5*1/36pt#;    % for small refinements of stem breadth
  400. vair_corr#:=5*2/36pt#;    % for small refinements of hairline height
  401. apex_corr#:=f*14/36pt#;    % extra width at diagonal junctions
  402.  
  403. o#:=f*7/36pt#;      % amount of overshoot for curves
  404. apex_o#:=0pt#;      % amount of overshoot for diagonal junctions
  405.  
  406. slant:=0;      % tilt ratio $(\Delta x/\Delta y)$
  407. fudge:=.91;      % factor applied to weights of heavy characters
  408. math_spread:=-.3;    % extra openness of math symbols
  409. superness:=.74;      % parameter for superellipses
  410. superpull:=1/18;    % extra openness inside bowls
  411. beak_darkness:=0;    % fraction of triangle inside beak serifs
  412. ligs:=2;      % level of ligatures to be included
  413.  
  414. square_dots:=true;    % should dots be square?
  415. hefty:=true;      % should we try hard not to be overweight?
  416. serifs:=false;      % should serifs and bulbs be attached?
  417. monospace:=false;    % should all characters have the same width?
  418. variant_g:=true;    % should an italic-style g be used?
  419. low_asterisk:=false;    % should the asterisk be centered at the axis?
  420. math_fitting:=false;    % should math-mode spacing be used?
  421.  
  422. font_setup;
  423.  
  424. cmchar "The letter T";
  425. beginchar("T",13u#-width_adj#,cap_height#,0);
  426. italcorr cap_height#*slant-beak_jut#-.25u#;
  427. adjust_fit(0,0);
  428. h:=vround(h-2stem_corr);
  429. pickup tiny.nib; pos1(cap_stem,0); pos2(cap_stem,0);
  430. lft x1l=lft x2l=hround(.5w-.5cap_stem); top y1=h; bot y2=0;
  431. filldraw stroke z1e--z2e; % stem
  432. pickup crisp.nib; pos3(slab,90); pos4(hair,0);
  433. top y3r=h; x3=x1; rt x4r=hround(w-.65u); y4=good.y(y3l-beak);
  434. arm(3,4,e,beak_darkness,.7beak_jut);  % right arm and beak
  435. pos5(hair,180); x5=w-x4; y5=y4;
  436. arm(3,5,f,beak_darkness,-.7beak_jut);  % left arm and beak
  437. if serifs: dish_serif(1,2,a,1/3,.5cap_jut,b,1/3,.5cap_jut);  % upper bracketing
  438.  dish_serif(2,1,c,1/3,1.414cap_jut,d,1/3,1.414cap_jut); fi  % lower serif
  439. math_fit(-.75cap_height#*slant,ic#-2.5u#); penlabels(1,2,3,4,5,6); endchar;
  440.  
  441. cmchar "The letter h";
  442. beginchar("h",10u#,asc_height#,0);
  443. italcorr .5[bar_height#,x_height#]*slant-serif_fit#+.5stem#-2u#;
  444. adjust_fit(serif_fit#+stem_shift#,serif_fit#-stem_shift#);
  445. pickup tiny.nib; pos1(stem,0); pos2(stem,0);
  446. pos1'(stem',0); pos2'(stem',0); pos3(stem,0);
  447. lft x1l=hround(2.5u-.5stem); x1l=x1'l=x2l=x2'l; x3=w-x1;
  448. top y1=h; bot y2=0; y1=y1'; y2=y2';
  449. filldraw stroke z1'e--z2'e;  % left stem
  450. h_stroke(2,a,3,4);  % arch and right stem
  451. if serifs: sloped_serif.l(1',2',b,1/3,jut,serif_drop); % upper left serif
  452.  numeric inner_jut; pickup tiny.nib;
  453.  if rt x2r+jut+.5u+1<=lft x4l-jut: inner_jut=jut;
  454.  else: rt x2r+jut+.5u+1=lft x4l-inner_jut; fi
  455.  dish_serif(2,1,c,1/3,jut,d,1/3,jut); % lower left serif
  456.  dish_serif(4,3,e,1/3,inner_jut,f,1/3,jut); fi % lower right serif
  457. penlabels(1,2,3,4); endchar;
  458.  
  459. cmchar "The letter e";
  460. beginchar("e",7.25u#+max(.75u#,.5curve#),x_height#,0);
  461. italcorr .5[bar_height#,x_height#]*slant+.5min(curve#-1.5u#,0);
  462. adjust_fit(if monospace: .25u#,.5u# else: 0,0 fi);
  463. numeric left_curve,right_curve;
  464. left_curve=right_curve+6stem_corr=curve if not serifs: -3stem_corr fi;
  465. if right_curve<tiny.breadth: right_curve:=tiny.breadth; fi
  466. if left_curve<tiny.breadth: left_curve:=tiny.breadth; fi
  467. pickup tiny.nib; pos1(right_curve,0);
  468. pos2(vair,90); pos3(left_curve,180);
  469. y1=good.y bar_height; top y2r=h+vround 1.5oo; y0l=bot y1;
  470. rt x1r=hround min(w-.5u,w-u+.5right_curve);
  471. lft x3r=hround max(.5u,1.25u-.5left_curve); x2=.5w+.25u;
  472. {{interim superness:=more_super;
  473.  filldraw stroke super_arc.e(1,2)}};  % right bowl
  474. y3=.5[y2,y4]; bot y4r=-oo; x4=x2+.25u;
  475. if serifs: pos4(vair',270); pos5(hair,360);
  476.  y5=max(good.y(.5bar_height-.9),y4l+vair); x5r=x1r;
  477.  (x,y4l)=whatever[z4r,z5]; x4l:=x;
  478.  filldraw stroke pulled_arc.e(2,3) & pulled_arc.e(3,4)
  479.   ...{x5-x4,5(y5-y4)}z5e; % left bowl, arc, and terminal
  480. else: pos4(vair,270);
  481.  filldraw stroke super_arc.e(2,3) & super_arc.e(3,4);  % left bowl and arc
  482.  pickup fine.nib; pos4'(vair,270); z4=z4';
  483.  pos5(.5[vair,flare],275); rt x5r=hround(w-.6u);
  484.  y5r=good.y(y5r+1/3bar_height-y5); y5l:=good.y y5l; x5l:=good.x x5l;
  485.  filldraw stroke term.e(4',5,right,1,4); fi  % terminal
  486. path testpath; testpath=super_arc.r(2,3) & super_arc.r(3,4);
  487. y1'r=y0r=y0l+.6[thin_join,vair]; y1'l=y0l; x1'l=x1'r=x1;
  488. forsuffixes $=l,r:
  489.  x0$=xpart(((0,y0$)--(x1,y0$)) intersectionpoint testpath); endfor
  490. fill stroke z0e--z1'e;  % crossbar
  491. penlabels(0,1,2,3,4,5); endchar;
  492.  
  493. cmchar "The letter E";
  494. beginchar("E",12u#-width_adj#,cap_height#,0);
  495. italcorr cap_height#*slant-beak_jut#-.5u#;
  496. adjust_fit(cap_serif_fit#,0);
  497. h:=vround(h-stem_corr);
  498. pickup tiny.nib; pos1(cap_stem,0); pos2(cap_stem,0);
  499. lft x1l=lft x2l=hround max(2u,3u-.5cap_stem); top y1=h; bot y2=0;
  500. filldraw stroke z1e--z2e; % stem
  501. pickup crisp.nib; pos3(slab,90); pos4(hair,0);
  502. top y3r=h; x3=x1; rt x4r=hround(w-u); y4=good.y(y3l-beak);
  503. arm(3,4,e,beak_darkness,beak_jut);  % upper arm and beak
  504. pos5(cap_bar,-90); pos6(hair,0);
  505. top y5l=vround(.52[y2,y1]+.5cap_bar); x5=x1;
  506. pos0(cap_bar,90); pos7(hair,0);
  507. z0=z5; x6=x7; y6-y5l=y0l-y7;
  508. if serifs: rt x6r=hround(w-4.4u+.5hair); y6=good.y(y5l+.6beak);
  509.  rt x9r=hround(w-.5u);
  510. else: rt x6r=hround(w-1.5u); y6=y5l; rt x9r=hround(w-.75u); fi
  511. arm(5,6,f,beak_darkness,0); arm(0,7,g,beak_darkness,0);  % middle arm and serif
  512. pos8(slab if not serifs:+2stem_corr fi,-90); pos9(hair,0);
  513. bot y8r=0; x8=x2; y9=y8l+7/6beak;
  514. arm(8,9,h,beak_darkness,1.5beak_jut);  % lower arm and beak
  515. if serifs: dish_serif(1,2,a,1/3,cap_jut,b,1/3,.5cap_jut);  % upper serif
  516.  dish_serif(2,1,c,1/3,cap_jut,d,1/3,.5cap_jut); fi  % lower serif
  517. math_fit(0,.5ic#); penlabels(0,1,2,3,4,5,6,7,8,9); endchar;
  518.  
  519. cmchar "The letter X";
  520. beginchar("X",13u#,cap_height#,0);
  521. italcorr cap_height#*slant-.25u#;
  522. adjust_fit(cap_serif_fit#,cap_serif_fit#);
  523. numeric stem[],outer_jut,xjut,alpha[];
  524. stem1=cap_stem-2stem_corr; stem2=min(cap_hair,stem1);
  525. outer_jut=.75cap_jut; xjut= if serifs: (stem1-stem2)/4 else: 0 fi;
  526. x1l=l+letter_fit+.5u+outer_jut; x2r=r-letter_fit-u-outer_jut-xjut;
  527. x3l=l+letter_fit+.25u+outer_jut+xjut; x4r=r-letter_fit-.25u-outer_jut;
  528. y1=y2=h; y3=y4=0;
  529. alpha1=diag_ratio(1,stem1,h,x4r-x1l);
  530. alpha2=diag_ratio(1,stem2,h,x2r-x3l);
  531. penpos1(alpha1*stem1,0); penpos2(alpha2*stem2,0);
  532. penpos3(alpha2*stem2,0); penpos4(alpha1*stem1,0);
  533. if hefty: z0=whatever[z1,z4]=whatever[z2,z3];
  534.  x12=x34=x0; y13=y24=y0;
  535.  z12=whatever[z2l,z3l]; z13=whatever[z2l,z3l];
  536.  z24=whatever[z2r,z3r]; z34=whatever[z2r,z3r];
  537.  forsuffixes $=13,24,34: z$'=.1[z$,z0]; endfor
  538.  fill diag_end(12,1r,.5,1,1l,13')--z13'--diag_end(13',3l,1,.5,3r,34')--z34'
  539.   --diag_end(34',4l,.5,1,4r,24')--z24'
  540.   --diag_end(24',2r,1,.5,2l,12)--z12--cycle; % diagonals
  541. else: fill diag_end(4r,1r,.5,1,1l,4l)
  542.   --diag_end(1l,4l,.5,1,4r,1r)--cycle; % left diagonal
  543.  fill diag_end(2l,3l,.5,1,3r,2r)
  544.   --diag_end(3r,2r,.5,1,2l,3l)--cycle; fi  % right diagonal
  545. if serifs: numeric inner_jut[]; pickup tiny.nib;
  546.  prime_points_inside(1,4); prime_points_inside(2,3);
  547.  prime_points_inside(3,2); prime_points_inside(4,1);
  548.  if rt x1'r+cap_jut+.5u+1<=lft x2'l-cap_jut-xjut: inner_jut1=cap_jut;
  549.  else: rt x1'r+inner_jut1+.5u+1=lft x2'l-inner_jut1-xjut; fi
  550.  if rt x3'r+cap_jut+.5u+1<=lft x4'l-cap_jut-xjut: inner_jut2=cap_jut;
  551.  else: rt x3'r+inner_jut2+.5u+1=lft x4'l-inner_jut2-xjut; fi
  552.  dish_serif(1',4,a,1/3,outer_jut,b,2/3,inner_jut1);  % upper left serif
  553.  dish_serif(4',1,c,2/3,inner_jut2,d,1/3,outer_jut);  % lower right serif
  554.  dish_serif(2',3,e,2/3,inner_jut1+xjut,
  555.   f,1/2,outer_jut+xjut)(dark);  % upper right serif
  556.  dish_serif(3',2,g,1/2,outer_jut+xjut,
  557.   h,2/3,inner_jut2+xjut)(dark); fi  % lower left serif
  558. math_fit(0,.5ic#); penlabels(0,1,2,3,4,12,13,24,34); endchar;
  559.  
  560. cmchar "The letter b";
  561. beginchar("b",10u#+serif_fit#,asc_height#,0);
  562. italcorr .5x_height#*slant+min(.5curve#-u#,-.25u#);
  563. adjust_fit(serif_fit#,0);
  564. pickup tiny.nib; pos1(stem',0); pos2(stem,0);
  565. pos0'(stem',0); pos0(stem,0); z0l=z0'l; x0'=x1; x0=x2;
  566. lft x1l=hround(2.5u-.5stem'); top y1=h;
  567. numeric edge; edge=rt x2r;
  568. pickup fine.nib; pos3(if hefty:thin_join else: hair fi,180);
  569. pos4(vair,90); pos5(curve,0);
  570. pos6(vair,-90); penpos7(x3l-x3r,-180);
  571. rt x3l=1/3[rt x2,edge]; y3=1/8[bar_height,x_height];
  572. x4l=w-.5(w-serif_fit)+.5u; top y4r=x_height+oo;
  573. rt x5r=hround min(w-1.35u+.5curve,w-.6u); y5=.5x_height;
  574. x6l=x4l-.2u; bot y6r=-oo;
  575. x7=x3; y7=min(y3,y6+y4-y3+.6vair);
  576. (x,y4r)=whatever[z3l,z4l]; x4r:=min(x,.5[x4,x5r]);
  577. (x',y6r)=whatever[z7l,z6l]; x6r:=min(x',.5[x6,x5r]);
  578. filldraw stroke z3e{up}...pulled_arc.e(4,5)&pulled_arc.e(5,6)...{up}z7e; % bowl
  579. y0=ypart(((edge,h)--(edge,0))intersectionpoint(z3l{up}...{right}z4l));
  580. y2=ypart(((edge,h)--(edge,0))intersectionpoint(z6l{left}...{up}z7l));
  581. pickup tiny.nib; filldraw stroke z1e--z0'e--z0e--z2e;  % stem
  582. pickup crisp.nib; pos8(hair,0); pos7'(stem,0);
  583. z7'=z2; x8l=x7'l; bot y8=0;
  584. filldraw stroke z7'e--z8e;  % point
  585. if serifs: sloped_serif.l(1,0',a,1/3,jut,serif_drop); fi  % upper serif
  586. penlabels(0,1,2,3,4,5,6,7,8); endchar;
  587.  
  588. cmchar "The letter o";
  589. beginchar("o",9u#,x_height#,0);
  590. italcorr .7x_height#*slant;
  591. adjust_fit(if monospace: .5u#,.5u# else: 0,0 fi);
  592. penpos1(vair,90); penpos3(vair',-90);
  593. penpos2(curve,180); penpos4(curve,0);
  594. x2r=hround max(.5u,1.25u-.5curve);
  595. x4r=w-x2r; x1=x3=.5w; y1r=h+vround 1.5oo; y3r=-oo;
  596. y2=y4=.5h-vair_corr; y2l:=y4l:=.52h;
  597. penstroke pulled_arc.e(1,2) & pulled_arc.e(2,3)
  598.  & pulled_arc.e(3,4) & pulled_arc.e(4,1) & cycle;  % bowl
  599. penlabels(1,2,3,4); endchar;
  600.  
  601. cmchar "The letter k";
  602. beginchar("k",9.5u#,asc_height#,0);
  603. italcorr x_height#*slant-.2u#;
  604. adjust_fit(serif_fit#,serif_fit#); pickup tiny.nib;
  605. numeric right_jut,stem[],alpha[];
  606. stem1=max(tiny.breadth,hround(fudged.stem-stem_corr));
  607. stem2=max(tiny.breadth,hround(fudged.stem-2stem_corr));
  608. stem3=max(tiny.breadth,hround(fudged.hair-4stem_corr));
  609. stem4=max(tiny.breadth,hround(fudged.stem-3stem_corr));
  610. if serifs: right_jut=.6jut; else: right_jut=.4tiny; fi
  611. pos1(stem1,0); pos2(stem2,0); top y1=h; bot y2=0;
  612. lft x1l=lft x2l=hround(2.5u-.5stem1);
  613. top y3=x_height; rt x3r=hround(r-letter_fit-.7u-right_jut);
  614. bot y6=0; rt x6r=hround(r-letter_fit-.3u-right_jut);
  615. x4=x11=x1; y4=.7bar_height; y11=y3;
  616. alpha1=diag_ratio(1,.5(stem3-tiny),y3-y4,x3r-x4);
  617. alpha2=diag_ratio(1,.5(stem4-tiny),y11-y6,x6r-x1);
  618. penpos3(alpha1*(stem3-tiny),0); penpos4(whatever,-90);
  619. z5=.5[z5l,z5r]; penpos6(alpha2*(stem4-tiny),0);
  620. forsuffixes $=l,r: y3'$=x_height; y6'$=0; z4$=z3'$+whatever*(z3-z4);
  621.  z5$=z6'$+whatever*(z11-z6)=whatever[z3,z4]; endfor
  622. z3'r=z3r+penoffset z3-z4 of currentpen+whatever*(z3-z4);
  623. % we have also |z3'l=z3l+penoffset z4-z3 of currentpen+whatever*(z3-z4)|;\]
  624. z6'r=z6r+penoffset z11-z6 of currentpen+whatever*(z11-z6);
  625. z6'l=z6l+penoffset z6-z11 of currentpen+whatever*(z11-z6);
  626. fill z4r--diag_end(4r,3'r,1,.5,3'l,4l)--z4l--cycle;  % upper diagonal
  627. fill z5l--diag_end(5l,6'l,.5,1,6'r,5r)--z5r--cycle;  % lower diagonal
  628. pos0(stem1,0); pos0'(stem2,0); y0=y0'; x0=x1; x0'=x2;
  629. rt z0r=whatever[z3,z4]; filldraw stroke z1e..z0e--z0'e..z2e; % stem
  630. if serifs: numeric inner_jut;
  631.  if rt x2r+jut+.5u+1<=lft x6l-jut: inner_jut=jut;
  632.  else: rt x2r+inner_jut+.5u+1=lft x6l-inner_jut; fi
  633.  sloped_serif.l(1,0,a,1/3,jut,serif_drop); % upper stem serif
  634.  dish_serif(2,0',b,1/3,jut,c,1/3,inner_jut);  % lower stem serif
  635.  dish_serif(3,4,d,2/3,1.4jut,e,1/2,right_jut)(dark); % upper diagonal serif
  636.  dish_serif(6,5,f,1/2,inner_jut,g,1/3,right_jut)(dark);fi % lower diagonal serif
  637. penlabels(0,1,2,3,4,5,6,11); endchar;
  638.  
  639. font_size 10pt#;
  640. font_identifier "CMMAN";
  641. font_coding_scheme "PI";
  642. bye
  643.